<template>
	<el-form ref="form" :model="form" label-width="80px">
	  <el-form-item label="菜单名称">
	    <el-input v-model="form.MenuName" ></el-input>
	  </el-form-item>
	  <el-form-item label="菜单分级">
	    <el-select v-model="form.PId" placeholder="请选择分级">
			<el-option v-for="pu in Pmenu" :key="pu.Id" :label="pu.MenuName" :value="pu.Id"></el-option>
	    </el-select>
	  </el-form-item>
	  <el-form-item label="菜单地址">
	    <el-input v-model="form.MenuUrl" ></el-input>
	  </el-form-item>
	  <el-form-item label="菜单图标">
	    <el-input v-model="form.MenuIcon" ></el-input>
	  </el-form-item>
	  
	  <el-form-item class="flex-row justify-center" label-width="0">
	    <el-button  type="primary" @click="onSubmit">修改</el-button>
	  </el-form-item>
	</el-form>
</template>

<script>
	import menuadd from '@/api/MenuApi.js'
	
		export default {
			props:["id"],
		    data() {
		      return {
		        form: {
		          MenuName: '',
		          PId: '',
		          MenuUrl: '',
		          MenuIcon: '',
		        
				},
				Pmenu:[]
		      }
		    },
		    methods: {
		      onSubmit() {
		        menuadd.Update(this.form).then(res=>{
					if(res.code==1){
						this.$message("修改成功")
					    this.$emit("CloseUpd")
					}
					
				})
		      }
		    },
			created(){
				menuadd.FuCha().then(res=>{
					this.Pmenu=res.data
				})
				menuadd.GetOne(this.id).then(res=>{
					this.form=res.data;
				})
			}
		  }
</script>

<style>
</style>